<html>
<head><meta charset="utf-8"><title>Target-feature iterator · t-libs/stdarch · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/index.html">t-libs/stdarch</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html">Target-feature iterator</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="175795472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795472">(Sep 16 2019 at 09:08)</a>:</h4>
<p><span class="user-mention" data-user-id="131070">@Luca Barbato</span> so what do you need the feature iterator for ? I've managed to rebase it, but I'm not sure it is ready for merging.</p>



<a name="175795484"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795484" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795484">(Sep 16 2019 at 09:08)</a>:</h4>
<p>My goal was switching rustc to use the same feature-detection as libstd</p>



<a name="175795502"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795502" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795502">(Sep 16 2019 at 09:08)</a>:</h4>
<p>The support for runtime disabling extension would need to map Feature to the strings provided by the env:var</p>



<a name="175795505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795505">(Sep 16 2019 at 09:08)</a>:</h4>
<p>right now, we use LLVM to detect features there, and LLVM might not 100% agree with libstd on what features are available</p>



<a name="175795543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795543">(Sep 16 2019 at 09:09)</a>:</h4>
<p>The override is to disable more features so that part is fine</p>



<a name="175795633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795633">(Sep 16 2019 at 09:10)</a>:</h4>
<p>hmm, so the envar would have a string of features, e.g., <code>"avx,aes"</code> etc. right ?</p>



<a name="175795636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795636">(Sep 16 2019 at 09:10)</a>:</h4>
<p>yes</p>



<a name="175795651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795651">(Sep 16 2019 at 09:10)</a>:</h4>
<p>and where in std::detect do you want to implement the override ?</p>



<a name="175795678"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795678" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795678">(Sep 16 2019 at 09:11)</a>:</h4>
<p>probably not at the macro level, and probably before the dispatch to the actual feature detection for the target</p>



<a name="175795691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795691">(Sep 16 2019 at 09:11)</a>:</h4>
<p><code>STD_DETECT_DISABLE="avx2" my_bin</code> would run it with avx2 off even if the system claims it is</p>



<a name="175795693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795693">(Sep 16 2019 at 09:11)</a>:</h4>
<p>so that one does not have to implement it for every target</p>



<a name="175795709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795709">(Sep 16 2019 at 09:11)</a>:</h4>
<p>I refactored <code>check_for</code> so I can run the env check there</p>



<a name="175795755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795755">(Sep 16 2019 at 09:12)</a>:</h4>
<p>ah, that what that was for, great</p>



<a name="175795761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795761">(Sep 16 2019 at 09:12)</a>:</h4>
<p>yes so it makes sense</p>



<a name="175795763"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795763" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795763">(Sep 16 2019 at 09:12)</a>:</h4>
<p>hmm</p>



<a name="175795775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795775">(Sep 16 2019 at 09:12)</a>:</h4>
<p>we probably want to read the override variable only once, cache it in a bitset</p>



<a name="175795778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795778">(Sep 16 2019 at 09:12)</a>:</h4>
<p>exactly :)</p>



<a name="175795779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795779">(Sep 16 2019 at 09:12)</a>:</h4>
<p>and then only do a bit test</p>



<a name="175795792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795792">(Sep 16 2019 at 09:12)</a>:</h4>
<p>so what do you need the feature iterator there for?</p>



<a name="175795800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795800">(Sep 16 2019 at 09:13)</a>:</h4>
<p>I get from the env</p>



<a name="175795804"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795804" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795804">(Sep 16 2019 at 09:13)</a>:</h4>
<p>do you want to dynamically create the bitset ?</p>



<a name="175795814"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795814" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795814">(Sep 16 2019 at 09:13)</a>:</h4>
<p><code>"foo, bar, baz"</code></p>



<a name="175795830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795830">(Sep 16 2019 at 09:13)</a>:</h4>
<p>I split the <code>,</code> and then for each string I need to to map a Feature</p>



<a name="175795879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795879">(Sep 16 2019 at 09:14)</a>:</h4>
<p>and then flip off the bit in the cache</p>



<a name="175795899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795899">(Sep 16 2019 at 09:14)</a>:</h4>
<p>So I need the from_str part</p>



<a name="175795903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795903">(Sep 16 2019 at 09:14)</a>:</h4>
<p>mainly</p>



<a name="175795915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795915">(Sep 16 2019 at 09:15)</a>:</h4>
<p>then if the iterator itself needs more work it is fine</p>



<a name="175795928"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795928" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795928">(Sep 16 2019 at 09:15)</a>:</h4>
<p>one discussion item if we want to make the iterator return a 3 items tuple</p>



<a name="175795930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795930">(Sep 16 2019 at 09:15)</a>:</h4>
<p>ah I see (I forgot that the <code>from_str</code> part was already implemented)</p>



<a name="175795937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795937">(Sep 16 2019 at 09:15)</a>:</h4>
<p>with one item for the env override</p>



<a name="175795963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175795963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175795963">(Sep 16 2019 at 09:15)</a>:</h4>
<p>so the program knows what is available and what is off for external reasons</p>



<a name="175796015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796015">(Sep 16 2019 at 09:16)</a>:</h4>
<p>hmm, dunno</p>



<a name="175796029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796029">(Sep 16 2019 at 09:16)</a>:</h4>
<p>but its use-case is relatively fringe (a program wanting  to tell the user what's is on and off)</p>



<a name="175796036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796036">(Sep 16 2019 at 09:16)</a>:</h4>
<p>the point of the override it is to be able to override it</p>



<a name="175796045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796045">(Sep 16 2019 at 09:16)</a>:</h4>
<p>if a program can inspect that, and ignore it, then I don't know</p>



<a name="175796079"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796079" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796079">(Sep 16 2019 at 09:17)</a>:</h4>
<p>not ignore</p>



<a name="175796084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796084">(Sep 16 2019 at 09:17)</a>:</h4>
<p>basically</p>



<a name="175796100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796100">(Sep 16 2019 at 09:17)</a>:</h4>
<p>also, thinking about it, no, but query the value, and do something depending on it</p>



<a name="175796119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796119">(Sep 16 2019 at 09:17)</a>:</h4>
<p>I suppose that initially this does not matter, because the iterator isn't public</p>



<a name="175796140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796140">(Sep 16 2019 at 09:18)</a>:</h4>
<p>my main use-case is to debug behavior on user-machine</p>



<a name="175796185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796185">(Sep 16 2019 at 09:18)</a>:</h4>
<p>so all I need is a way for the user to turn off a feature without having to rebuild everything</p>



<a name="175796186"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796186" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796186">(Sep 16 2019 at 09:18)</a>:</h4>
<p>so maybe we could add that later</p>



<a name="175796190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796190">(Sep 16 2019 at 09:18)</a>:</h4>
<p>definitely</p>



<a name="175796191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796191">(Sep 16 2019 at 09:18)</a>:</h4>
<p>but right now the iterator returns whether a feature is enabled, using the normal check</p>



<a name="175796193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796193">(Sep 16 2019 at 09:18)</a>:</h4>
<p>basically all I need is the from_str</p>



<a name="175796198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796198">(Sep 16 2019 at 09:19)</a>:</h4>
<p>and that check will be overriden by the env</p>



<a name="175796203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796203">(Sep 16 2019 at 09:19)</a>:</h4>
<p>and it is fine</p>



<a name="175796204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796204">(Sep 16 2019 at 09:19)</a>:</h4>
<p>ok</p>



<a name="175796215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796215">(Sep 16 2019 at 09:19)</a>:</h4>
<p>the iterator is good since it can be used on a <code>--help</code> path</p>



<a name="175796222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796222">(Sep 16 2019 at 09:19)</a>:</h4>
<p>i think we can do it like this initially, and we'll see</p>



<a name="175796224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796224">(Sep 16 2019 at 09:19)</a>:</h4>
<p>so there is a mean to discover what can be turn off or on</p>



<a name="175796227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796227">(Sep 16 2019 at 09:19)</a>:</h4>
<p>maybe we should add an UNSTABLE to the env variable</p>



<a name="175796274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796274">(Sep 16 2019 at 09:20)</a>:</h4>
<p>to make it clear that this API is not stable</p>



<a name="175796284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796284">(Sep 16 2019 at 09:20)</a>:</h4>
<p>and maybe even somehow disable it for stable Rust</p>



<a name="175796293"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796293" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796293">(Sep 16 2019 at 09:20)</a>:</h4>
<p>Initially I thought of using a feature guard</p>



<a name="175796314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796314">(Sep 16 2019 at 09:20)</a>:</h4>
<ul>
<li>the no_std guard since iirc we cannot reach the env w/out std, right? :)</li>
</ul>



<a name="175796315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796315">(Sep 16 2019 at 09:20)</a>:</h4>
<p>I also thought about having <code>FOO="avx=off:avx512f:on"</code> kind of syntax</p>



<a name="175796323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796323">(Sep 16 2019 at 09:21)</a>:</h4>
<p>no :)</p>



<a name="175796325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796325">(Sep 16 2019 at 09:21)</a>:</h4>
<p>but disabling features is always sound</p>



<a name="175796327"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796327" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796327">(Sep 16 2019 at 09:21)</a>:</h4>
<p>you can ONLY disable it</p>



<a name="175796329"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796329" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796329">(Sep 16 2019 at 09:21)</a>:</h4>
<p>while enabling features can exhibit UB</p>



<a name="175796338"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796338" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796338">(Sep 16 2019 at 09:21)</a>:</h4>
<p>enabling a feature you do not support is a sigill</p>



<a name="175796340"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796340" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796340">(Sep 16 2019 at 09:21)</a>:</h4>
<p>I wonder if there is a feature that can exhibit UB when it is disabled</p>



<a name="175796394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796394">(Sep 16 2019 at 09:22)</a>:</h4>
<p>either way an <code>_UNSTABLE</code> env var that disables features on nightly for debugging seems ok</p>



<a name="175796402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> gnzlbg <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796402">(Sep 16 2019 at 09:22)</a>:</h4>
<p>I'll try and see if I can get this merged today</p>



<a name="175796407"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796407" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796407">(Sep 16 2019 at 09:22)</a>:</h4>
<p>great :)</p>



<a name="175796416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796416">(Sep 16 2019 at 09:22)</a>:</h4>
<p>I'll get the first draft of the code on top of it</p>



<a name="175796426"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/208962-t-libs/stdarch/topic/Target-feature%20iterator/near/175796426" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Luca Barbato <a href="https://rust-lang.github.io/zulip_archive/stream/208962-t-libs/stdarch/topic/Target-feature.20iterator.html#175796426">(Sep 16 2019 at 09:23)</a>:</h4>
<p>and let see what people think</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>